﻿#region 版权信息

//  ------------------------------------------------------------------------------
//   Copyright (C) 成都联宇创新科技有限公司 版权所有。 
//   
//   文件名：LotteryRecord.cs
//   文件功能描述：LotteryRecord.cs
//   创建标识：骆智慧 2014/07/16
//   
//   修改标识：
//   修改描述：
//  ------------------------------------------------------------------------------

#endregion

#region 名称空间导入

using System;
using Castle.ActiveRecord;

#endregion

namespace ECity.Domain
{
    /// <summary>
    ///     玩家抽奖记录
    /// </summary>
    [Serializable]
    [ActiveRecord(Tables.LotteryRecord)]
    public class LotteryRecord : ActiveRecordBase<LotteryRecord>
    {
        /// <summary>
        ///     编号
        /// </summary>
        [PrimaryKey(PrimaryKeyType.Sequence, SequenceName = Sequences.LotteryRecord)]
        public virtual int ID { get; set; }

        /// <summary>
        ///     参与的抽奖活动
        /// </summary>
        [BelongsTo("SWEEPSTAKE_ID", NotNull = true)]
        public virtual LotterySweepstake Sweepstake { get; set; }


        /// <summary>
        ///     中奖奖项
        /// </summary>
        [BelongsTo("PRIZE_ID", NotNull = true)]
        public virtual LotteryPrize LotteryPrize { get; set; }


        /// <summary>
        ///     抽奖时间
        /// </summary>
        [Property(Column = "PLAY_TIME", NotNull = true)]
        public virtual DateTime PlayTime { get; set; }

        /// <summary>
        ///     抽奖序列号
        /// </summary>
        [Property(Column = "PLAY_SERIAL", NotNull = true)]
        public virtual string PlaySerial { get; set; }

        /// <summary>
        ///     抽奖结果 1 中奖 0没中奖
        /// </summary>
        [Property("PLAY_RESULT", NotNull = true)]
        public virtual int PlayResult { get; set; }

        /// <summary>
        ///     玩家称呼/账号
        /// </summary>
        [Property("PLAYER", NotNull = true)]
        public virtual string Player { get; set; }

        public override int GetHashCode()
        {
            return Tables.LotteryRecord.GetHashCode() ^ ID;
        }
    }
}